<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">

        <ul>
            <li v-for='item1 in arr'> {{item1}}</li>
        </ul>

        <!--  v-for  是数据 (数组,对象 数字 )  都可以进行遍历-->
        <!-- v-for='item in  data 里面数组的名字 '  item  则表示 数组里面的每一项  -->
        <ul>
            <li v-for='item in list'>
                {{item.title}}
            </li>
        </ul>
        <!--  遍历 带索引 -->
        <ul>

            <li v-for='(item,index) in list'>
                {{item.title}} --------------索引:{{index}}
            </li>
        </ul>

        <!-- 遍历 带索引  带唯一不重复的key   一般用id 作为key -->
        <ul>

            <li v-for='(item,index) in list' :key='item.id'>
                {{item.title}} --------------索引:{{index}}
            </li>
        </ul>

        <!-- 遍历对象 -->


        <ul>
            <li  v-for='(val,key,index) in   obj'>

             值： {{val}}  ----- key:{{key}} --------  索引：{{index}}
                
            </li>
        </ul>

        <ul>
            <li v-for='item in num'> {{item}}</li>
        </ul>





    </div>
    <script src="./vue.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                num:10,
                arr: ['张三', '李四'],
                list: [

                    {
                        id: 1,
                        title: 'apple',

                    }, {
                        id: 2,
                        title: 'orange',

                    }, {
                        id: 3,
                        title: 'lemon',

                    }
                ],

                obj: {
                    uname: 'zhangsan',
                    age: 13,
                    gender: 'female'
                }

            },
            methods: {}
        });
    </script>
</body>

</html>